home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / tools / rtmem.exe / RTMEM.DOC < prev   
Encoding:
Text File  |  1992-03-10  |  16.6 KB  |  403 lines

  1.                                  RTMEM 1.10
  2.  
  3.     Purpose
  4.     -------
  5.     RTMEM (Run-Time MEMory) is a programmer's diagnostic aid that allows
  6.     you to easily run programs with a specific amount of free memory
  7.     available.  It is easier to use than the traditional "memory eaters"
  8.     and more accurate than loading other programs, adjusting BUFFERS,
  9.     etc., simply to take up space.
  10.  
  11.     Version 1.10 largely automates the process of determining the
  12.     correct memory size when running programs under a debugger and adds
  13.     options to specify the amount of EMS and XMS memory to make
  14.     available.
  15.  
  16.     | marks features that are new or changed for this version.
  17.  
  18.  
  19.     Background
  20.     ----------
  21.     It is not at all uncommon for a program to operate correctly on the
  22.     developer's system but fail on a user's system.  There are many
  23.     possible causes for this situation; one of these is that the user's
  24.     system has less free memory available for the program.
  25.  
  26.     The traditional approach to analyzing whether or not this is the
  27.     case is to reduce the developer's system's free memory in one way or
  28.     another, then run the program to see if it fails.  This is typically
  29.     accomplished by loading multiple copies of COMMAND.COM or DEBUG, by
  30.     increasing FILES and/or BUFFERS, by running the program from the
  31.     "shell" option of an application, or by using tools such as Turbo
  32.     Power Software's EATMEM.
  33.  
  34.     The problem with adjusting BUFFERS or loading other programs before
  35.     running the target is that it's hard to "eat" just the right amount
  36.     of memory; and unless you have exactly the right amount of free RAM,
  37.     you may not see the problem.  EATMEM is better, but it has two
  38.     problems.  First, it's still rather coarse (allocations are made in
  39.     units of K-bytes).  Second, it's a TSR.  Once memory has been
  40.     "eaten" by EATMEM, you can't get it back without either rebooting or
  41.     using a TSR manager such as MARK/RELEASE.
  42.  
  43.     RTMEM solves these problems; it allows you to specify the exact
  44.     amount of free memory you want available to the target program, and
  45.     it is not a TSR.  After running the target program, you still have
  46.     all of your original DOS memory free.
  47.  
  48.  
  49.     Use
  50.     ---
  51.     The complete syntax of RTMEM is:
  52.  
  53.   |     RTMEM [/Dxxxx] [/En] [/Xn] memorysize program [options]
  54.  
  55.     but basic usage of RTMEM is very simple:
  56.  
  57.         RTMEM memorysize d:\path\name.exe [options]
  58.  
  59.     The first argument is the amount of free memory you want available
  60.     to the target program (NOT the amount of memory you want RTMEM to
  61.     "eat").  It is specified in bytes, not KB or paragraphs.  Note,
  62.     however, that DOS allocates memory in units of paragraphs (16
  63.     bytes); RTMEM will round up to the next paragraph if you specify a
  64.     number that is not a multiple of 16 bytes.  For ease of data entry,
  65.     you can include commas in the memory size; RTMEM will ignore them.
  66.  
  67.     The second argument is the fully-qualified name of the program you
  68.     want to run: the drive, path, name and extension.  You can omit the
  69.     drive and/or path only if the program is located in the default
  70.     drive and/or path; RTMEM does not search the system PATH.
  71.  
  72.     Following the program name are any parameters required for operation
  73.     of the program (i.e., the same parameters/options you would use to
  74.     run the program without RTMEM).
  75.  
  76.     Examples:
  77.  
  78.         RTMEM 314992 c:\arf\foo.exe /d /e
  79.  
  80.     This example runs C:\ARF\FOO.EXE with 314,992 bytes of free memory.
  81.     The options "/d /e" are passed along to FOO.EXE.
  82.  
  83.         RTMEM 145,008 c:\dos\mem.exe
  84.  
  85.     This example runs MEM.EXE with 145,008 bytes of free memory.  The
  86.     display from MEM.EXE shows the following when run on our system with
  87.     this command:
  88.  
  89.         655360 bytes total conventional memory
  90.         655360 bytes available to IBM DOS
  91.         145008 largest executable program size      <---
  92.  
  93.     Before running the program, RTMEM displays the segment address at
  94.     which the target program will load:
  95.  
  96.         Target program will load at 7F09
  97.  
  98.     This message indicates that the program will be loaded at segment
  99.     7F09 (hex).  This will be the address of the program's PSP, not of
  100.     its environment.
  101.  
  102.     When the target program terminates, RTMEM regains control and
  103.     returns to DOS, releasing any memory that it has allocated.
  104.  
  105.  
  106.   | Specifying free EMS
  107.   | -------------------
  108.   | To specify an amount of EMS (expanded memory) to make available, use
  109.   | the /E option.  The /E takes a numeric argument, which is the amount
  110.   | of free EMS (specified in K-bytes) that you want to make available
  111.   | to the program.  For example, if you want FOO.EXE to run with 135008
  112.   | bytes of DOS RAM and 512K of EMS:
  113.   |
  114.   |     RTMEM /E512 135008 C:\ARF\FOO.EXE
  115.   |
  116.   | The /E option, if present, must precede the DOS memory size.
  117.   |
  118.   | You can specify /E0 to "eat" all available EMS, leaving none for
  119.   | the target program to use.
  120.   |
  121.   | Because EMS is always allocated in pages of 16K bytes each, RTMEM
  122.   | rounds up to the next 16K if necessary.
  123.   |
  124.   |
  125.   | Specifying free XMS
  126.   | -------------------
  127.   | To specify an amount of XMS (extended memory) to make available, use
  128.   | the /X option.  The /X takes a numeric argument, which is the amount
  129.   | of free XMS (specified in K-bytes) that you want to make available
  130.   | to the program.  For example, if you want FOO.EXE to run with 135008
  131.   | bytes of DOS RAM and 512K of EMS:
  132.   |
  133.   |     RTMEM /X512 135008 C:\ARF\FOO.EXE
  134.   |
  135.   | The /X option, if present, must precede the DOS memory size.
  136.   |
  137.   | This option affects only extended memory that is managed by an XMS
  138.   | manager (like HIMEM.SYS, 386MAX and QEMM), not the so-called "INT
  139.   | 15" extended memory that is used by programs like VDISK.
  140.   |
  141.   | This option affects only the size of the largest block of free XMS;
  142.   | discontiguous smaller blocks are not affected.
  143.   |
  144.   | You can specify /X0 to "eat" all of the largest available block of
  145.   | XMS.
  146.  
  147.  
  148.     Environment
  149.     -----------
  150.     The question arises, "what about the system environment?"  Suppose
  151.     a customer reports that your program fails on his system and the
  152.     running MEM indicates 542,496 bytes of free memory.  You can easily
  153.     run
  154.  
  155.         RTMEM 542,496 c:\myprog.exe
  156.  
  157.     But what if your DOS environment is not the same size as your
  158.     customer's?  If your environment is 1K larger than his, doesn't that
  159.     mean that using the same size will actually result in 1K less memory
  160.     available to the program on your system than on his?
  161.  
  162.     In general, the answer is "no," if you are using either MEM or
  163.     CHKDSK to report free memory.  Both of these programs report the
  164.     amount of memory that will be available to run a program AFTER space
  165.     has been allocated for the current environment.  RTMEM also follows
  166.     this convention; in other words, if you tell it to allow X bytes of
  167.     free memory for a program, it assumes you mean X bytes of memory
  168.     free AFTER the new environment has been allocated.  Therefore, use
  169.     the exact number reported by either MEM or CHKDSK when running
  170.     RTMEM.
  171.  
  172.  
  173.     Running under a debugger
  174.     ------------------------
  175.  
  176.   | Once you have determined that memory size is indeed the problem, you
  177.   | may need to run the target program (with the correct memory size)
  178.   | under a debugger.  The debugger must be run under RTMEM in such a
  179.   | way that the correct amount of memory is available to the target
  180.   | program when it has been loaded by the debugger.
  181.   |
  182.   | In other words, the trick is to run the debugger in the correct
  183.   | amount of memory (using RTMEM) so that, after the memory used by the
  184.   | debugger has been subtracted, the correct amount is left for the
  185.   | target program.
  186.   |
  187.   | Here is how to set the correct amount of memory when running under
  188.   | a debugger:
  189.   |
  190.   |     1. Load the target program under your debugger; do not begin
  191.   |     execution.  Display the CPU registers and make a note of the
  192.   |     value contained in the DS register.  This is the segment address
  193.   |     at which your debugger has loaded the target program.  NOTE:
  194.   |     use the full path to your debugger when you run it; this is
  195.   |     necessary to ensure that the debugger's environment is the same
  196.   |     size it will be when you run it under RTMEM later.
  197.   |
  198.   |     2. Exit the debugger back to the DOS prompt.
  199.   |
  200.   |     3. Now run the debugger under RTMEM, adding a /D option before
  201.   |     the memory size. The argument of the /D option is the segment
  202.   |     address noted in step 1:
  203.   |
  204.   |         RTMEM /Dxxxx memorysize debugger program [options]
  205.   |
  206.   | For example, suppose you want to run C:\ARF\FOO.EXE under DEBUG with
  207.   | 135,008 bytes of free memory.  The steps above might look like this:
  208.   |
  209.   |     1. Run DEBUG:
  210.   |
  211.   |             C:\DOS\DEBUG.COM C:\ARF\FOO.EXE
  212.   |
  213.   |        Display the registers:
  214.   |
  215.   |             AX=0000  BX=0000  ...
  216.   |             DS=0BCB  ES=0BCB  ...
  217.   |
  218.   |        Note the DS value (0BCB).
  219.   |
  220.   |     2. Quit DEBUG.
  221.   |
  222.   |     3. Start DEBUG again, this time using RTMEM; use the /D option,
  223.   |     specifying the segment address from step 1:
  224.   |
  225.   |         RTMEM /D0BCB 135008 C:\DOS\DEBUG.COM C:\ARF\FOO.EXE
  226.   |
  227.   | To confirm, note the initial value of DS when the target program is
  228.   | loaded under your debugger.  This should be the same value displayed
  229.   | by RTMEM if you run the target program directly (without the
  230.   | debugger) and specify the desired memory size.  In our example:
  231.   |
  232.   |     C> RTMEM 135008 C:\ARF\FOO.EXE
  233.   |     target program will load at 7F09
  234.   |     ...
  235.   |     C> RTMEM /D0BCB 135008 C:\DOS\DEBUG.COM C:\ARF\FOO.EXE
  236.   |     -R
  237.   |     AX=0000  BX=0000  ...
  238.   |     DS=7F09  ES=7F09  ...
  239.   |
  240.   | Note that the value of DEBUG's DS is the same as the load address
  241.   | displayed by RTMEM.
  242.  
  243.  
  244.     Error messages
  245.     --------------
  246.     RTMEM reports the following errors:
  247.  
  248.     requested size greater than available memory
  249.         The memory size you specified on the command line is greater
  250.         than the amount of memory currently available.  RTMEM can only
  251.         decrease free memory, not increase it.
  252.  
  253.     program not found (remember to use path and extension)
  254.         RTMEM was unable to find the target program.  Be sure that you
  255.         have specified everything it needs to find the program: the
  256.         drive (if the program is not on the current drive), the
  257.         directory (if the program is not in the current directory), and
  258.         the program name AND extension.  Do not rely on the PATH.
  259.  
  260.     requested size is not enough to run the program
  261.         RTMEM could not run the target program due to insufficient
  262.         memory; in other words, you executed "RTMEM 50000 foo.exe",
  263.         and FOO.EXE cannot run in 50,000 bytes of memory.
  264.  
  265.     error running program
  266.         Catch-all message for other errors encountered in attempting
  267.         to run the program.  You should not see this message...
  268.  
  269.     memory size specified greater than 1MB
  270.         Just what it says: you specified a memory size larger than 1MB.
  271.  
  272.     EMS manager not found
  273.         RTMEM was unable to locate the EMS manager software.  Either the
  274.         driver is not loaded or it has been corrupted.
  275.  
  276.     EMS manager not responding
  277.         The EMS manager software is not responding correctly; it may
  278.         be corrupted.
  279.  
  280.     requested EMS greater than available
  281.         The amount of free EMS memory your requested with the /E option
  282.         is greater than the amount of EMS currently available.
  283.  
  284.     XMS manager not found
  285.         RTMEM was unable to locate the XMS manager software.  Either the
  286.         driver is not loaded or the system has been corrupted.
  287.  
  288.     XMS manager not responding
  289.         The XMS manager software is not responding correctly; it may
  290.         be corrupted.
  291.  
  292.     requested XMS greater than available
  293.         The amount of free XMS memory your requested with the /X option
  294.         is greater than the amount of XMS currently available.
  295.  
  296.  
  297.     Version history
  298.     ---------------
  299.     1.10 (10 Mar 92)
  300.         Adds /D option (set size under debugger)
  301.         Adds /E option (specify available EMS)
  302.         Adds /X option (specify available XMS)
  303.  
  304.     1.10 (1 Jan 92)
  305.         Initial release
  306.  
  307.  
  308.                          COPYRIGHT/LICENSE/WARRANTY
  309.                          --------------------------
  310.  
  311.     This document and the program file RTMEM.COM ("the software") are
  312.  
  313.                              Copyright (C) 1992
  314.                           The Cove Software Group
  315.                             All Rights Reserved
  316.  
  317.     The copyright owner hereby licenses you to: use the software except
  318.     as below; make as many copies of the program and documentation as
  319.     you wish; give such copies to anyone; and distribute the software
  320.     and documentation via electronic means.  There is no charge for any
  321.     of the above.
  322.  
  323.     You are specifically prohibited from charging, or requesting
  324.     donations, for any such copies, however made; and from distributing
  325.     the software and/or documentation with commercial products without
  326.     prior permission in writing from the copyright owner.
  327.  
  328.     Persons and organizations who are engaged in the distribution of
  329.     shareware, "freeware", and/or public domain software may include RTMEM
  330.     on distribution disks as long as charges are made on a per-disk
  331.     basis rather than a per-program basis.  The charge per disk may not
  332.     exceed $7 US.  Such persons and organizations must not represent
  333.     themselves as vendors, distributors, or sellers of RTMEM.
  334.  
  335.     RTMEM may not be used in a commercial, governmental, or institutional
  336.     environment.  It is intended for personal use only.  Other users
  337.     should contact us for licensing information.
  338.  
  339.     No copy of the software may be distributed without this document;
  340.     and the contents of the document must not be altered.
  341.  
  342.     There is no warranty of any kind, and the copyright owner is not
  343.     liable for damages of any kind.  By using this free software, you
  344.     agree to this.
  345.  
  346.                       -------------------------------
  347.  
  348.                           The Cove Software Group
  349.                             Post Office Box 1072
  350.                             Columbia, MD  21044
  351.                                 410/992-9371
  352.                            CompuServe: 76703,2002
  353.  
  354.                      Program and documentation author:
  355.                            Christoper J. Dunford
  356.  
  357.          ----------------end-of-author's-documentation---------------
  358.  
  359.                          Software Library Information:
  360.  
  361.                     This disk copy provided as a service of
  362.  
  363.                            Public (software) Library
  364.  
  365.          We are not the authors of this program, nor are we associated
  366.          with the author in any way other than as a distributor of the
  367.          program in accordance with the author's terms of distribution.
  368.  
  369.          Please direct shareware payments and specific questions about
  370.          this program to the author of the program, whose name appears
  371.          elsewhere in  this documentation. If you have trouble getting
  372.          in touch with the author,  we will do whatever we can to help
  373.          you with your questions. All programs have been tested and do
  374.          run.  To report problems,  please use the form that is in the
  375.          file PROBLEM.DOC on many of our disks or in other written for-
  376.          mat with screen printouts, if possible.  PsL cannot debug pro-
  377.          programs over the telephone, though we can answer questions.
  378.  
  379.          Disks in the PsL are updated  monthly,  so if you did not get
  380.          this disk directly from the PsL, you should be aware that the
  381.          files in this set may no longer be the current versions. Also,
  382.          if you got this disk from another vendor and are having prob-
  383.          lems,  be aware that  some files may have become corrupted or
  384.          lost by that vendor. Get a current, working disk from PsL.
  385.  
  386.          For a copy of the latest monthly software library newsletter
  387.          and a list of the 4,000+ disks in the library, call or write
  388.  
  389.                            Public (software) Library
  390.                                P.O.Box 35705 - F
  391.                             Houston, TX 77235-5705
  392.  
  393.                                  Orders only:
  394.                                 1-800-2424-PSL
  395.                               MC/Visa/AmEx/Discover
  396.  
  397.                           Outside of U.S. or in Texas
  398.                           or for general information,
  399.                               Call 1-713-524-6394
  400.  
  401.  
  402.  
  403.